<!DOCTYPE html>
<html lang="zh-cn">
   <head>
      <meta charset="utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <title>{$CONF['mallTitle']}后台管理中心</title>
      <link href="__PUBLIC__/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">
      <link href="__CSS__/AdminLTE.css" rel="stylesheet" type="text/css" />
      <link href="__CSS__/upload.css" rel="stylesheet" type="text/css" />
      <!--[if lt IE 9]>
      <script src="__PUBLIC__/js/html5shiv.min.js"></script>
      <script src="__PUBLIC__/js/respond.min.js"></script>
      <![endif]-->
      <script src="__PUBLIC__/js/jquery.min.js"></script>
      <script src="__PUBLIC__/plugins/bootstrap/js/bootstrap.min.js"></script>
      <script src="__PUBLIC__/plugins/formValidator/formValidator-4.1.3.js"></script>
      <script src="__PUBLIC__/js/common.js"></script>
      <script src="__PUBLIC__/plugins/plugins/plugins.js"></script>
      <script type="text/javascript" src="__JS__/upload.js"></script>
   </head>
   <script>
    var ThinkPHP = window.Think = {
      "ROOT"   : "__ROOT__"
    }
   var filetypes = ["gif","jpg","png","jpeg"];
   $(function () {
	   $.formValidator.initConfig({
		   theme:'Default',mode:'AutoTip',formID:"myform",debug:true,submitOnce:true,onSuccess:function(){
				   edit();
			       return false;
			},onError:function(msg){
		}});
	   $("#catName").formValidator({onShow:"",onFocus:"",onCorrect:"输入正确"}).inputValidator({min:1,max:20,onError:"商品分类不能超过20个字符"});
   });
   function edit(){
      var isFixed = $('#isFixed').val();
      var ji = $('#ji').val();
	   var params = {};
	   params.id = $('#id').val();
	   params.parentId = $('#parentId').val();
	   params.catName = $('#catName').val();
	   params.priceSection = $('#priceSection').val();
	   params.isShow = $('input[name="isShow"]:checked').val();;
	   params.catSort = $('#catSort').val();
    params.cateImg = $('#cateImg').val();

     params.isHot = $('input[name = "isHot"]:checked').val();
     params.isRecomm = $('input[name = "isRecomm"]:checked').val();
	   Plugins.waitTips({title:'信息提示',content:'正在提交数据，请稍后...'});
	   $.post("{:U('Admin/GoodsCats/edit')}",params,function(data,textStatus){
			var json = WST.toJson(data);console.log(json);
			if(json.status=='1'){
				Plugins.setWaitTipsMsg({ content:'操作成功',timeout:1000,callback:function(){
            if(isFixed > 0){
              location.href='{:U("Admin/GoodsCats/fixedIndex")}';
            }else{
              location.href='{:U("Admin/GoodsCats/index")}';
            }
				   
				}});
			}else{
				Plugins.closeWindow();
				Plugins.Tips({title:'信息提示',icon:'error',content:'操作失败!',timeout:1000});
			}
	   });
   }
   
   </script>
   <body class="wst-page">
      <!--图片预览-->
      <iframe name="upload" style="display:none"></iframe>
      <form id="uploadform_Cate" autocomplete="off" style="position:absolute;top:140px;left:120px;z-index:10;" enctype="multipart/form-data" method="POST" target="upload" action="{:U('Home/Shops/uploadPic')}" >
        <div style="position:relative;">
        <input id="cateImg" name="cateImg" class="form-control wst-ipt" type="text" value="{$object.cateImg}" readonly style="margin-right:4px;float:left;margin-left:8px;width:250px;"/>
        <div class="div1">
          <div class="div2">浏览</div>
          <input type="file" class="inputstyle" id="Cate" name="Cate" onchange="updfile('Cate');" >
        </div>
        <div style="clear:both;"></div>
        <div >&nbsp;图片大小:150 x 120 (px)(格式为 gif, jpg, jpeg, png)</div>
        <input type="hidden" name="dir" value="goodscate">
        <input type="hidden" name="width" value="150">
        <input type="hidden" name="folder" value="Cate">
        <input type="hidden" name="sfilename" value="Cate">
        <input type="hidden" name="fname" value="cateImg">
        <input type="hidden" id="s_Filedata" name="s_Filedata" value="">
        </div>
    </form>
      <!--商品分类信息-->
       <form name="myform" method="post" id="myform" autocomplete="off">
        <input type='hidden' id='id' value='{$object.catId}'/>
        <input type='hidden' id='parentId' value='{$object.parentId}'/>
        <input type="hidden" id="isFixed" value="{$isFixed}">
        <input type="hidden" id="ji" value="{$object.ji}" />
        <table class="table table-hover table-striped table-bordered wst-form">
           <tr>
             <th width='120' align='right'>商品分类名称<font color='red'>*</font>：</th>
             <td><input type='text' id='catName' class="form-control wst-ipt" value='{$object.catName}' maxLength='25'/></td>
             <td rowspan='5'>
              <div id="preview_Cate">
                 <img id='cate' src='<if condition="$object['cateImg'] =='' ">__ROOT__/{$CONF['goodsImg']}<else/>__ROOT__/{$object['cateImg']}</if>' height='160'/><br/>
              </div>
             </td>
           </tr>
            <tr>
             <th align='right'>是否热门<font color='red'>*</font>：</th>
             <td>
             <label>
             <input type='radio' id='isHot1' value='1' name='isHot' <if condition="$object['isHot'] ==1 ">checked</if>/>是
             </label>
             <label>
             <input type='radio' id='isHot0' value='0' name='isHot' <if condition="$object['isHot'] ==0 ">checked</if>/>否
             </label>
             </td>
           </tr>
            <tr>
             <th align='right'>是否推荐<font color='red'>*</font>：</th>
             <td>
             <label>
             <input type='radio' id='isRecomm1' value='1' name='isRecomm' <if condition="$object['isRecomm'] ==1 ">checked</if>/>是
             </label>
             <label>
             <input type='radio' id='isRecomm0' value='0' name='isRecomm' <if condition="$object['isRecomm'] ==0 ">checked</if>/>否
             </label>
             </td>
           </tr>
           <tr>
             <th align='right'>是否显示<font color='red'>*</font>：</th>
             <td>
             <label>
             <input type='radio' id='isShow1' value='1' name='isShow' <if condition="$object['isShow'] ==1 ">checked</if>/>显示
             </label>
             <label>
             <input type='radio' id='isShow0' value='0' name='isShow' <if condition="$object['isShow'] ==0 ">checked</if>/>隐藏
             </label>
             </td>
           </tr>

           <tr style="height:80px;">
               <th align='right'>商品分类图片<font color='red'>*</font>：</th>
               <td colspan='2'></td>
            </tr>

           <tr>
           </tr>
             <th align='right'>排序号：</th>
             <td><input type='text' id='catSort' class="form-control wst-ipt" value='{$object.catSort}' style='width:80px' onkeypress="return WST.isNumberKey(event)" onkeyup="javascript:WST.isChinese(this,1)" maxLength='8'/></td>
           </tr>
           <tr>
             <td colspan='2' style='padding-left:250px;'>
                 <button type="submit" class="btn btn-success">保&nbsp;存</button>
                 <if condition="$isFixed neq 0">
                    <a class="btn btn-primary" href='{:U("Admin/GoodsCats/fixedIndex")}'>返&nbsp;回</button>
                 <else />
                    <a class="btn btn-primary" href='{:U("Admin/GoodsCats/index")}'>返&nbsp;回</button>
                 </if>
                  
             </td>
           </tr>
        </table>
       </form>
   </body>
</html>